<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body></body>
  <script>
    // 提取  变量.match(正则对象)  没有提取到打印null
    var str = "We are all good children and love examsA";
    console.log(str.match("a"));
    console.log(str.match(/z/gi));
    /*
      g: 全局匹配
      i: 不区分大小写
    */
    // 替换
    console.log(str.replace("a", "b"));
    console.log(str.replace(/a/gi, "b"));
    console.log(str.replaceAll("d", "r"));
  </script>
</html>
